<template>
	<image v-if="type == 1" class="avatar-container" :style="`width:${size}upx;height:${size}upx`" src="@/static/images/avatar.png"
		mode="aspectFit" @tap="toPage"></image>
	<image v-else class="avatar-container type2" :style="`width:${size}upx;height:${size}upx`" src="@/static/images/avatar2.png"
		mode="aspectFit" @tap="toPage"></image>
</template>

<script>
	export default {
		name: "Avatar",
		props: {
			size: {
				type: Number,
				default: 80,
			},
			url: {
				type: String,
				default: "/pages/index",
			},
			type: {
				type: Number,
				default: 1,
			}
		},
		methods: {
			toPage() {
				if (this.url) {
					this.$tab.navigateTo(this.url)
				}
			}
		}
	}
</script>

<style lang="scss">
	.avatar-container {
		border: 6upx solid #f2f2f2;
		border-radius: 50%;
		&.type2 {
			border: none;
			border-radius: initial;
		}
	}
</style>